import axios from "axios";
import Vue from 'vue';

var _axios = axios.create({
  baseURL: "https://yjb.zjic.com.cn/jeecg-boot",
  // baseURL: "http://localhost:9080/jeecg-boot",
  timeout: 30 * 1000,
});

//添加请求拦截器
_axios.interceptors.request.use(
  function (config) {
    const token = Vue.ls.get("Authorization")
    if (token) {
      config.headers['Authorization'] = 'Bearer ' + token // 让每个请求携带自定义 token 请根据实际情况自行修改
    }
    return config;
  },

  function (error) {
    //请求错误时做些事
    return Promise.reject(error);
  }
);

export default _axios;